<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#counter {
			  font-size: 36px;
			  font-weight: bold;
			}

		</style>
	</head>
	<body>
		<div id="counter">0</div>

	</body>
</html>

<script type="text/javascript">
	function animateValue(id, start, end, duration) {
	    var range = end - start;
	    var current = start;
	    var increment = end > start? 1 : -1;
	    var stepTime = Math.abs(Math.floor(duration / range));
	    var obj = document.getElementById(id);
	  
	    var timer = setInterval(function() {
	        current += increment;
	        obj.textContent = current;
	        if (current == end) {
	            clearInterval(timer);
	        }
	    }, 100);
	}
	animateValue("counter", 0, 100, 2000); // 从0增加到100，过程持续2000毫秒

</script>